Filter hook 'site_option_{$option}'

in WP Core File wp-includes/option.php at line 2116

View Source

site_option_{$option}

Filter Hook
Description
Filters the value of an existing network option. The dynamic portion of the hook name, `$option`, refers to the option name.

Hook Information

File Location wp-includes/option.php View on GitHub
Hook Type Filter
Line Number 2116

Hook Parameters

Type Name Description
mixed $value Value of network option.
string $option Option name.
int $network_id ID of the network.

Usage Examples

Basic Usage
<?php
// Hook into site_option_{$option}
add_filter('site_option_{$option}', 'my_custom_filter', 10, 3);

function my_custom_filter($value, $option, $network_id) {
    // Your custom filtering logic here
    return $value;
}

Source Code Context

wp-includes/option.php:2116 - How this hook is used in WordPress core
<?php
2111  	 *
2112  	 * @param mixed  $value      Value of network option.
2113  	 * @param string $option     Option name.
2114  	 * @param int    $network_id ID of the network.
2115  	 */
2116  	return apply_filters( "site_option_{$option}", $value, $option, $network_id );
2117  }
2118  
2119  /**
2120   * Adds a new network option.
2121   *

PHP Documentation

<?php
/**
	 * Filters the value of an existing network option.
	 *
	 * The dynamic portion of the hook name, `$option`, refers to the option name.
	 *
	 * @since 2.9.0 As 'site_option_' . $key
	 * @since 3.0.0
	 * @since 4.4.0 The `$option` parameter was added.
	 * @since 4.7.0 The `$network_id` parameter was added.
	 *
	 * @param mixed  $value      Value of network option.
	 * @param string $option     Option name.
	 * @param int    $network_id ID of the network.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/option.php
Related Hooks

Related hooks will be displayed here in future updates.